package org.syncsoft.overalt.core.api;


import java.util.Collection;
import java.util.Set;

import org.syncsoft.overalt.common.exception.SystemException;
import org.syncsoft.overalt.domain.community.entity.Community;
import org.syncsoft.overalt.domain.document.entity.Document;
import org.syncsoft.overalt.domain.document.entity.Permission;
import org.syncsoft.overalt.domain.folder.entity.TypeShare;
import org.syncsoft.overalt.domain.folder.entity.TypeSyncronization;
import org.syncsoft.overalt.domain.tag.entity.Tag;
import org.syncsoft.overalt.domain.user.entity.User;

/**
 * provide an interface to control the application business rules 
 * @author tptfc
 *
 */
public interface ICore {
	/**
	 * update the single file
	 * 
	 * @param path
	 * @throws SystemException
	 */
	public void update(String path) throws SystemException;
	
	/**
	 * similar to server update document
	 * 
	 * @param filePath
	 * @param title
	 * @param description
	 * @param versionDescription
	 * @param communities
	 * @param permission
	 * @param tags
	 * @throws SystemException
	 */
	public void commit(String filePath, String title, String description, String versionDescription ,Set<Community> communities, Permission permission, Set<Tag> tags) throws SystemException;
	
	/**
	 * 
	 * @param filesPaths
	 * @param versionDescription
	 * @throws SystemException
	 */
	public void commit(Collection<String> filesPaths, String versionDescription) throws SystemException;
	
	/**
	 * similar to server create document
	 * 
	 * @param filePath
	 * @param title
	 * @param description
	 * @param communities
	 * @param tags
	 * @param permission
	 * @throws SystemException
	 */
	public void addFile(String filePath, String title, String description, Set<Community> communities, Set<Tag> tags, Permission permission) throws SystemException;
	
	/**
	 * delete a file
	 * 
	 * @param path
	 * @throws SystemException
	 */
	public void delete(String path) throws SystemException;
	
	/**
	 * shared the folder
	 * 
	 * @param folderPath
	 * @param typeShare
	 * @param autoFillTitleDesc
	 * @param contatcs
	 * @param community
	 * @param members
	 * @param autoSync
	 * @param typeSync
	 * @param tags
	 * @throws SystemException
	 */
	public void shareFolder(String folderPath, TypeShare typeShare, boolean autoFillTitleDesc, Set<Integer> contatcs, Integer communityCode, Set<Integer> membersCode, boolean autoSync, TypeSyncronization typeSync, Set<Tag> tags) throws SystemException;
	
	/**
	 * login in the system
	 * 
	 * @param login
	 * @param passsword
	 * @return
	 * @throws SystemException
	 */
	public boolean login(String login, String passsword) throws SystemException;

	/**
	 * get userInSession communities
	 * 
	 * @return
	 * @throws SystemException
	 */
	public Collection<Community> getComunities() throws SystemException;
	
	/**
	 * get community members
	 * 
	 * @param communityId
	 * @return
	 * @throws SystemException
	 */
	public Collection<User> getCommunityMembers(int communityId) throws SystemException;

	/**
	 * get userInSession contacts
	 * 
	 * @return
	 * @throws SystemException
	 */
	public Collection<User> getContacts() throws SystemException;

	/**
	 * 
	 * @param folderPath
	 * @return
	 * @throws SystemException
	 */
	public Collection<Document> getModifiedFiles(String folderPath) throws SystemException;
	
	/**
	 * verify if the user is logged
	 */
	public void verifyLogin();	
	
	public Document getFileLocalDocument(String filePath) throws SystemException;

	public Integer getFolderCommunityId(String folderPath) throws SystemException;

	public Set<User> getFolderContacts(String folderPath) throws SystemException;

	public Set<User> getFolderMembersCommunity(String folderPath) throws SystemException;

	public Set<Tag> getFolderTags(String folderPath) throws SystemException;

	public boolean getFolderAutoFillTitleDescription(String folderPath) throws SystemException;

	public boolean getFolderAutoSync(String folderPath) throws SystemException;

	public TypeShare getFolderTypeShare(String folderPath) throws SystemException;

	public TypeSyncronization getFolderTypeSync(String folderPath) throws SystemException;
	
	public boolean isFileShared(String filePath) throws SystemException;
	
	public boolean isFolderShared(String folderPath) throws SystemException;
	
	public Set<Tag> getFileTags(String filePath) throws SystemException;
	
	public Set<Community> getFileCommunities(String filePath) throws SystemException;
	
	public String getFileDescription(String filePath) throws SystemException;
	
	public String getFileTitle(String filePath) throws SystemException;
}
